package com.spddr.pmos.cxf;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

import com.spddr.pmos.jpa.Company;
import com.spddr.pmos.jpa.Customer;
import com.spddr.pmos.jpa.Organization;
import com.spddr.pmos.jpa.Plant;

import cn.seqdata.cxf.repos.JaxrsObjectRepository;

@Path("/company")
public interface JaxrsCompany extends JaxrsObjectRepository<Company> {
	@PUT
	@Path("/")
	default <S extends Company> S save(S entity) {
		return getRepository().save(entity);
	}

	@GET
	@Path("/{id}/children")
	List<Company> children(@PathParam("id") long id);

	@GET
	@Path("/{id}/plants")
	List<Plant> plants(@PathParam("id") long id);

	@GET
	@Path("/{id}/customers")
	List<Customer> customers(@PathParam("id") long id);
	
	@GET
	@Path("/{name}/cc")
	List<Organization> findLikeName(@PathParam("name") String name);
}
